<?php
include "konek.php";
$bln = date('Y-m-d');
// menampilkan tanggal 10 hari sebelumnya dari tanggal hari ini berdasarkan timestamp nya

$x1 = date("Y-m-d");
$x  = mktime(0, 0, 0, date("m"), date("d"),  date("Y"));
$xd= date("l", $x);
$feb = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$x1%' and (status='Open' || status='Aktif') order by ticket_id desc");
//var_dump(mysql_fetch_array($jan));
$feb1=  mysql_fetch_array($feb);
$a = $feb1['FEB'];
//
$n = 10;
$nextN = mktime(0, 0, 0, date("m"), date("d") -1, date("Y"));
$next1= date("Y-m-d", $nextN);
$x3  = mktime(0, 0, 0, date("m"), date("d")-1,  date("Y"));
$xd3= date("l", $x3);

$feb2 = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next1%' and (status='Open' || status='Aktif') order by ticket_id desc");
//var_dump(mysql_fetch_array($jan));
$feb21=  mysql_fetch_array($feb2);
$b = $feb21['FEB'];

echo $b;

//

$nextN1 = mktime(0, 0, 0, date("m"), date("d") -2, date("Y"));
$next12= date("Y-m-d", $nextN1);
$x4  = mktime(0, 0, 0, date("m"), date("d")-2,  date("Y"));
$xd2= date("l", $x4);

$feb3 = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next12%' and (status='Open' || status='Aktif') order by ticket_id desc");
//var_dump(mysql_fetch_array($jan));
$feb31=  mysql_fetch_array($feb3);
$c = $feb31['FEB'];
//

$nextN2 = mktime(0, 0, 0, date("m"), date("d") -3, date("Y"));
$next13= date("Y-m-d", $nextN2);
$x5  = mktime(0, 0, 0, date("m"), date("d")-3,  date("Y"));
$xd5= date("l", $x5);

$feb4 = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next13%' and (status='Open' || status='Aktif') order by ticket_id desc");
//var_dump(mysql_fetch_array($jan));
$feb41=  mysql_fetch_array($feb4);
$d = $feb41['FEB'];
//

$nextN4 = mktime(0, 0, 0, date("m"), date("d") -4, date("Y"));
$next14= date("Y-m-d", $nextN4);
$x6  = mktime(0, 0, 0, date("m"), date("d")-4,  date("Y"));
$xd6= date("l", $x6);

$feb5 = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next14%' and (status='Open' || status='Aktif') order by ticket_id desc");
//var_dump(mysql_fetch_array($jan));
$feb51=  mysql_fetch_array($feb5);
$e = $feb51['FEB'];
//

$nextN5 = mktime(0, 0, 0, date("m"), date("d") -5, date("Y"));
$next15= date("Y-m-d", $nextN5);
$x7  = mktime(0, 0, 0, date("m"), date("d")-5,  date("Y"));
$xd7= date("l", $x7);

$feb6 = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next15%' and (status='Open' || status='Aktif') order by ticket_id desc");
//var_dump(mysql_fetch_array($jan));
$feb61=  mysql_fetch_array($feb6);
$f = $feb61['FEB'];
//

$nextN6 = mktime(0, 0, 0, date("m"), date("d") -6, date("Y"));
$next16= date("Y-m-d", $nextN6);
$x8  = mktime(0, 0, 0, date("m"), date("d")-6,  date("Y"));
$xd8= date("l", $x8);

$feb7 = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next16%' and (status='Open' || status='Aktif') order by ticket_id desc");
//var_dump(mysql_fetch_array($jan));
$feb71=  mysql_fetch_array($feb7);
$g = $feb71['FEB'];

//



 echo $xd3;



echo "<graph caption=' Ticket Created' xAxisName='Week ($bln)' yAxisName='Units' decimalPrecision='0' formatNumberScale='0'>";
echo "
	<set name='$xd' value='$a' color='AFD8F8' />
<set name='$xd3' value='$b' color='F6BD0F' />
<set name='$xd2' value='$c' color='8BBA00' />
<set name='$xd5' value='$d' color='FF8E46'/>
<set name='$xd6' value='$e' color='008E8E'/>
<set name='$xd7' value='$f' color='D64646'/>
<set name='$xd8' value='$g' color='8E468E'/>


";

echo "</graph>";


?>